/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_simple_expression.cpp

	$Header: /heroes4/script_simple_expression.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "script_simple_expression.h"
#include "adventure_map.h"

t_script_expression_day::t_result 
t_script_expression_day::evaluate(t_expression_context_global const& context) const
{
	return context.map->get_day() + 1;
}

t_script_expression_day_of_week::t_result 
t_script_expression_day_of_week::evaluate(t_expression_context_global const& context) const
{
	return (context.map->get_day() % 7) + 1;
}

t_script_expression_week::t_result 
t_script_expression_week::evaluate(t_expression_context_global const& context) const
{
	return (context.map->get_day() / 7) + 1;
}


t_script_expression_week_of_month::t_result 
t_script_expression_week_of_month::evaluate(t_expression_context_global const& context) const
{
	return ((context.map->get_day() / 7) % 4) + 1;
}

t_script_expression_month::t_result 
t_script_expression_month::evaluate(t_expression_context_global const& context) const
{
	return (context.map->get_day() / 28) + 1;
}

t_script_expression_true::t_result
t_script_expression_true::evaluate(t_expression_context_global const& context) const
{
	return true;
}

t_script_expression_false::t_result
t_script_expression_false::evaluate(t_expression_context_global const& context) const
{
	return false;
}


